#ifndef FILEWRITER_H
#define FILEWRITER_H

#include <string>
#include <fstream>
using namespace std;

#include "BitStream.h"
#include "QuantizationMatrix.h"

class FileWriter
{
public:
    FileWriter() {}
    ~FileWriter() {}

    void openFile(const string &filename);
    // returns true if successful
    bool writeFileHeader(int width, int height, QuantizationMatrix& qm);
    void writeFrameHeader(uint8_t type, uint32_t bitsWritten);
    bool writeData(util::BitStreamWriter* bsw);
    bool writeData(uint8_t* data, int length);
    void closeFile();

private:
    ofstream _file;
};

#endif // FILEWRITER_H
